是的,这恰恰意味着" 这样 ".这些是守卫,在Haskell中非常常见(通常优于等效if
then
else
表达式).
f x | x > 2 = a | x < -4 = b | otherwise = x
相当于
f x = if x > 2 then a else if x < -4 then b else x
国际海事组织,具体的例子实际上最好既if
没有保护也没有保护,但是
takeConstraint' = case n of "Unique" -> (Nothing, Nothing, Just $ takeUniq ps tableName defs rest, Nothing) "Foreign" -> (Nothing, Nothing, Nothing, Just $ takeForeign ps tableName defs rest) "Primary" -> (Nothing, Just $ takeComposite defs rest, Nothing, Nothing) "Id" -> (Just $ takeId ps tableName (n:rest), Nothing, Nothing, Nothing) _ -> (Nothing, Nothing, Just $ takeUniq ps "" defs (n:rest), Nothing)